package de.motsangria.mail;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import java.util.Properties;

public class MailAuthenticator extends Authenticator {

  private Properties props;

  public MailAuthenticator(Properties props) {
    this.props = props;
  }

  public Properties getProps() {
    return props;
  }

  public void setProps(Properties props) {
    this.props = props;
  }

  protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(props.getProperty("mail.pop3.user"), props.getProperty("mail.pop3.password"));
  }
}
